package org.jeecg.modules.health_records.health_abdophy.service.impl;

import org.jeecg.modules.health_records.family_doctor.mapper.FamilyDoctorInfoMapper;
import org.jeecg.modules.health_records.health_abdophy.entity.HealthAbdoPhyInfo;
import org.jeecg.modules.health_records.health_abdophy.mapper.HealthAbdoPhyInfoMapper;
import org.jeecg.modules.health_records.health_abdophy.service.IHealthAbdoPhyInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description: 现病史-体格检查-腹部体格检查
 * @Author: jeecg-boot
 * @Date:   2025-06-25
 * @Version: V1.0
 */
@Service
public class HealthAbdoPhyInfoServiceImpl extends ServiceImpl<HealthAbdoPhyInfoMapper, HealthAbdoPhyInfo> implements IHealthAbdoPhyInfoService {
    @Autowired
    private HealthAbdoPhyInfoMapper healthAbdoPhyInfoMapper;
    /**按recordid查询**/
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<HealthAbdoPhyInfo> queryByRecordId(HealthAbdoPhyInfo healthAbdoPhyInfo) {
        return healthAbdoPhyInfoMapper.queryByRecordId(Long.valueOf(healthAbdoPhyInfo.getRecordid()),healthAbdoPhyInfo.getIdNumber());

    }
    /**电子病历信息查询接口（查询时间最新的那条数据）--按recordid查询**/
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<HealthAbdoPhyInfo> queryElecRecord(HealthAbdoPhyInfo healthAbdoPhyInfo){

        return healthAbdoPhyInfoMapper.queryElecRecord(Long.valueOf(healthAbdoPhyInfo.getRecordid()),healthAbdoPhyInfo.getIdNumber());

    }
    //新规则查询当下时间往前12个月的就诊数据作为电子病历数据
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<HealthAbdoPhyInfo> newQueryElecRecord(HealthAbdoPhyInfo healthNeurIndexInf) {
        return healthAbdoPhyInfoMapper.newQueryElecRecord(Long.valueOf(healthNeurIndexInf.getRecordid()),healthNeurIndexInf.getSeeId(),healthNeurIndexInf.getIdNumber());

    }

    //新规则：除去当下时间往前12个月的就诊数据，剩下的数据为既往病历数据
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<HealthAbdoPhyInfo> newQueryPastRecord(HealthAbdoPhyInfo healthNeurIndexInf) {
        return healthAbdoPhyInfoMapper.newQueryPastRecord(Long.valueOf(healthNeurIndexInf.getRecordid()),healthNeurIndexInf.getSeeId(),healthNeurIndexInf.getIdNumber());

    }
}
